package com.gmadmin.commoncore.exception;

import lombok.Getter;

/**
 * @author qch
 * @since 2021/12/29 19:17
 */
@Getter
public class BaseException extends RuntimeException {

    /**
     * 业务路相应码
     */
    private final Integer code;

    /**
     * 返回信息
     */
    private final String formatMessage;

    /**
     * 填充formatMessage使用的参数
     */
    private final Object[] params;

    public BaseException(Integer code, String message, Object... params) {
        this.code = code;
        this.formatMessage = message;
        this.params = params;
    }

    public BaseException(Integer code, String message) {
        this(code, message, null);
    }

    public BaseException(String message) {
        this(10001, message);
    }
}
